<?php
$query_remplissage_variable = "SELECT *
FROM `diagnostic`
WHERE `form` LIKE " . $_SESSION ['form'];
// ~ echo $query_remplissage_variable;
$resultat_remplissage_variable = mysql_query ( $query_remplissage_variable ) or die ( "impossible de remplir le questionnaire : " . mysql_error () );
// ~ $resultat_remplissage_variable = mysqli_query($link, $query_remplissage_variable) or die("impossible de remplir le questionnaire : " . mysql_error());
$liste_infos_form = mysql_fetch_row ( $resultat_remplissage_variable );
// ~ $liste_infos_form = mysqli_fetch_row($resultat_remplissage_variable);

$query_showfields = "SHOW FIELDS FROM `diagnostic`";
$resultat_showfields = mysql_query ( $query_showfields );
// ~ $resultat_showfields = mysqli_query($link,$query_showfields);
$liste_champs = array ();
while ( $line = mysql_fetch_row ( $resultat_showfields ) ) {
	// ~ while($line = mysqli_fetch_row($resultat_showfields)){
	array_push ( $liste_champs, $line [0] );
}

$hash_champ_valeur = Array (); // champ => valeur ds la base
for($i = 0; $i < count ( $liste_champs ); $i ++) {
	$cle = $liste_champs [$i];
	if ($liste_infos_form [$i] == '') {
		$hash_champ_valeur [$cle] = NULL;
	} else {
		$hash_champ_valeur [$cle] = $liste_infos_form [$i];
	}
	// ~ print $cle." => ".$hash_champ_valeur[$cle]."<br />";
}

// ~ print_r($hash_champ_valeur);

?>
